package com.zhfi.dataapply.schedule.reader.chaincode;

import com.zhfi.dataapply.entity.data.po.chaincode.SocialSecurityProvinceCountPO;
import com.zhfi.dataapply.service.CVSourceUrlService;
import com.zhfi.dataapply.service.ForwardService;
import com.zhfi.dataapply.service.chaincode.OriginChainCodeListService;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Component
public class SocialSecurityProvinceCountReader extends AbstractChainKeyReader<SocialSecurityProvinceCountPO> {

    private static String URL_ID = "12.7";

    @Autowired
    private CVSourceUrlService cvSourceUrlService;

    @Getter
    private String url;

    @Autowired
    public SocialSecurityProvinceCountReader(ForwardService forwardService, OriginChainCodeListService originChainCodeListService) {
        super(SocialSecurityProvinceCountPO.class, forwardService, originChainCodeListService);
    }

    @Override
    public void resetUrl() {
        this.url = cvSourceUrlService.getUrlById(URL_ID);
    }

    @Override
    public SocialSecurityProvinceCountPO read() {
        SocialSecurityProvinceCountPO po = super.read();
        if (null != po) {
            po.setChainCode(originChainCodeList.get(originChainListSiteNum));
            po.setCompanyIpoType("ALL");
            po.setFinanceType("ALL");
        }
        return po;
    }

}
